import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/login/Login.vue'
import Layout from '@/components/layout/Layout.vue'
import Home from '@/views/home/Index.vue'
import GtyRouter from '@/views/gateway/GtyRouter.vue'
import ApiManage from '@/views/gateway/ApiManage.vue'
import AssistIndex from '@/views/assist/Index.vue'
import SystemIndex from '@/views/system/Index.vue'
import IM from '@/views/socket/Socket.vue'

Vue.use(Router)
// 门户通过fullPath跳转，子应用 菜单routelinkto -> fullPath,
// 子应用路由仍然通过path层级控制
//children 的path加/则 不和父级的path做拼接
const router = new Router({
  routes: [
    {
      path: '/',
      component: Login,
      meta: { needLogin: false, title: '登录页' },
    },
    {
      path: '/login',
      component: Login,
      meta: { needLogin: false, title: '登录页' },
    }, {
      path: '/dragon',
      component: Layout,
      children: [{
        path: '/dragon/home',
        component: Home,
        fullPath:"/dragon/home",
        meta: { needLogin: true, title: '主页' },
        name: '主页'
      }]
    }, {
      path: '/gty',
      component: Layout,
      children: [{
        path: '/gty/routeManage',
        component: GtyRouter,
        meta: { needLogin: true, title: '网关路由配置' },
        name: '网关路由配置'
      }]
    }, {
      path: '/gty',
      component: Layout,
      children: [{
        path: '/gty/apiManage',
        component: ApiManage,
        meta: { needLogin: true, title: '网关接口限流' },
        name: '网关路由配置'
      }]
    }, {
      path: '/assist',
      component: Layout,
      children: [{
        path: '/assist/index',
        component: AssistIndex,
        meta: { needLogin: true, title: '辅助功能' },
        name: '辅助功能'
      }]
    }, {
      path: '/system',
      component: Layout,
      children: [{
        path: '/system/index',
        component: SystemIndex,
        meta: { needLogin: true, title: '系统配置' },
        name: '系统配置'
      }]
    },{
      path: '/system',
      component: Layout,
      children: [{
        path: '/system/im',
        component: IM,
        meta: { needLogin: true, title: '及时通讯' },
        name: '及时通讯'
      }]
    }
  ]
});
export default router;